package com.szgz.platform.model;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 老师创建的共享环境资源（父表）
 */
@TableName("teacher_environment")
@Data
@Accessors(chain = true)
public class TeacherEnvironment {

    @TableId(value = "environment_id", type = IdType.ASSIGN_UUID)
    private String environmentId;

    @TableField("name")
    private String name;

    @TableField("type")
    private String type; // IDE/JUPYTER/MYSQL/...

    @TableField("group_id")
    private String groupId; // 关联班级/课堂ID

    @TableField("teacher_id")
    private String teacherId;

    @TableField("status")
    private String status; // CREATING/RUNNING/STOPPED/ERROR

    @TableField("description")
    private String description;

    @TableField("base_url")
    private String baseUrl; // 基础访问域名或服务入口

    @TableField("container_name")
    private String containerName; // 后端创建的容器名（如有）

    @TableField("port_mapping")
    private String portMapping; // JSON 文本

    @TableField("config_json")
    private String configJson; // JSON 文本（模板/参数）

    @TableField("api_token")
    private String apiToken;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;

    @TableLogic
    @TableField("deleted")
    private Integer deleted;

    public TeacherEnvironment() {
        this.createdAt = LocalDateTime.now();
        this.updatedAt = LocalDateTime.now();
        this.status = "CREATING";
        this.deleted = 0;
    }


}

